package text111;

public class Solution50 {
    public int cuttingRope(int n) {
    	if (n<4) {
			return n-1;
		}
		int a = n/3;
		int b = n%3;
		if (b==0) {
			return (int) Math.pow(3, a);
		}else if (b==1) {
			return (int) Math.pow(3, a-1)*2*2;
		}else {
				return (int) Math.pow(3, a)*b;
		}
    }
}
